package pre.liuxl.blog.repository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import pre.liuxl.blog.entity.UserFile;

import java.util.List;

/**
 * Created by liuxuanlong on 2018/6/29.
 */
@Repository
public class UserFileRepository {
    @Autowired
    HibernateTemplate hibernateTemplate;

    public List<UserFile> findAll() {
        UserFile userFile = new UserFile();
        return hibernateTemplate.findByExample(userFile);
    }

    @Transactional
    public void save(UserFile userFile) {
        hibernateTemplate.save(userFile);
    }
}
